<style>
	tr td{ margin:0;
		   padding:0;
	}
</style>
<span id="loader" url="<?=image_url('load.gif');?>"></span>
<div class="panel">
	<p><a href="<?=site_url();?>" class="btn btn-success"><strong>Exit</strong></a> Assign Students To Section.</p>
</div>
<?if($sections):?>
	<div id="follow" class="panel">
		<?if($sections):?>
			<?foreach($sections as $v):?>
				<span class="section-data" url="<?=site_url('output/section_data/'.__link($v['id']))?>" style="border:1px solid #000;padding:3px 5px;margin:0 2px 2px 2px;display:inline-block;-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;">
					<strong><?=ucwords(strtolower($v['section_name']));?></strong>
					<span class="badge label-inverse"><i class="icon-g-user icon-g-white"></i>&nbsp;<span class="section-male"><?=$v['male'];?></span></span>
					<span class="badge label-inverse"><i class="icon-g-girl icon-g-white"></i>&nbsp;<span class="section-female"><?=$v['female'];?></span></span>
					<span class="badge label-inverse"><i class="icon-g-group icon-g-white"></i>&nbsp;<span class="section-total"><?=$v['total'];?></span></span>
				</span>
			<?endforeach;?>
		<?endif;?>
	</div>
<?endif;?>
<?//pp($students);?>
<div>
	<ul class="nav nav-tabs">
		<?foreach($levels as $v):?>
			<li style="font-size:10px;" class="<?=$segment == $v->level_id ? 'current' : '';?>"><a href="<?=site_url('vice_principal/section_students_grid/'.$v->level_id);?>" ><?=$v->level_desc;?></a></li>
			<?$thelevels[$v->level_id] = $v->level_desc?>
		<?endforeach;?>
	</ul>
</div>

<?if(isset($students) AND !empty($students)):?>
	<table class="table table-bordered table-striped">
		<tr>
			<th>Student Name</th>
			<th>Age</th>
			<th>Gender</th>
			<th>&nbsp;</th>
			<th>&nbsp;</th>
			<th>&nbsp;</th>
		</tr>
		
		<tbody>
			<?foreach($students as $k=>$v):?>
				<tr class="<?=$v['linkid'];?>">
					<td><a style="font-size:12px;" href="<?=site_url('profile/student/'.$v['e_id']);?>" target="_blank"><?=ucwords(strtolower($v['fullname']));?></a></td>
					<td><?=$v['age'];?></td>
					<td><?=$v['gender'];?></td>
					<td>
						<span class="loading" style="display:inline-block;"></span>&nbsp;&nbsp;<?=form_dropdown('section',$v['available_sec'],set_value('section',$v['section']),'url="'.site_url('output/assignstudentsection/'.__link($v['e_id'],$v['grade_level']).'').'" class="update-sections" style="display:inline-block;width:70%;"');?>
					</td>
					<td>
						<span class="loading" style="display:inline-block;"></span>&nbsp;&nbsp;<?=form_dropdown('level',$thelevels,set_value('level',$v['grade_level']),'url="'.site_url('output/update_level/'.__link($v['e_id']).'" id="'.$v['linkid'].'"  class="update-level" style="display:inline-block;width:85%;"'));?>
					</td>
					<td>
						<span class="loading" style="display:inline-block;"></span>&nbsp;&nbsp;<?=form_dropdown('block',$available_block,set_value('block',$v['bid']),'url="'.site_url('output/update_level/'.__link($v['e_id']).'" id="'.$v['linkid'].'"  class="update-level" style="display:inline-block;width:85%;" disabled'));?>
					</td>
				</tr>
			<?endforeach;?>
		</tbody>
	</table>
<?else:?>
	<div class="alert alert-info">No students. Please select another grade level.</div>
<?endif;?>
<script type="text/javascript" src="<?php echo script_url('custom/updatesection');?>"></script>